//
//  ConsulationFunc1CellModel.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/31.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "ConsulationFunc1CellModel.h"

@interface ConsulationFunc1CellModel()

@end

@implementation ConsulationFunc1CellModel

- (instancetype)initWithData:(NSString *)data cellHeight:(CGFloat)cellHeight
{
    self = [super init];
    if (self)
    {
        _data = data;
        
        /// cellHeight+2（2容错）
        _cellHeight = MHUIScaleValue(cellHeight)+2;
        
        _askCmd = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
            
            UserManagerV2* um = [UserManagerV2 sharedUserManagerV2];
            
            if ([um isLogined])
            {
                return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
                    
                    [subscriber sendNext:nil];
                    [subscriber sendCompleted];
                    
                    return nil;
                }];
            }
            else
            {
                return [RACSignal error:[NSError errorWithDomain:SUCommandErrorDomain code:SUCommandErrorCode userInfo:@{SUCommandErrorUserInfoKey:@"请登录后再操作"}]];
            }
        }];
        _expertCmd = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
            
            return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
                
                [subscriber sendNext:nil];
                [subscriber sendCompleted];
                
                return nil;
            }];
        }];
        _searchCmd = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
            
            return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
                
                [subscriber sendNext:nil];
                [subscriber sendCompleted];
                
                return nil;
            }];
        }];
    }
    
    return self;
}

@end
